import Vue from 'vue'
import App from './App.vue'
import axios from 'axios'

Vue.config.productionTip = false

// 请求拦截器
axios.interceptors.request.use(config => {
  // 请求的域名统一设置
  config.baseURL = 'http://10.9.46.154:3000'
  // 超时
  config.timeout = 3000
  
  return config
})

axios.interceptors.response.use(
  ret => ret.data,
  err => Promise.reject(err)
)

Vue.prototype.$get = axios.get
Vue.prototype.$post = axios.post

// 事件总线
Vue.prototype.$bus = new Vue()

new Vue({
  render: h => h(App)
}).$mount('#app')
